package com.example.domain.entity;

import javax.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 单位换算规则实体类
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "unit_conversion_rules")
public class UnitConversionRule extends BaseEntity {

    @Id
    @Column(name = "id", length = 26)
    private String id;

    @Column(name = "from_unit", length = 20, nullable = false)
    private String fromUnit;

    @Column(name = "to_unit", length = 20, nullable = false)
    private String toUnit;

    @Column(name = "factor", precision = 18, scale = 6, nullable = false)
    private BigDecimal factor;

    @Column(name = "enabled", columnDefinition = "TINYINT(1) DEFAULT 1")
    private Boolean enabled = true;
}

